package com.starlink.controller.wechat;

import com.starlink.common.WebResponse;
import com.starlink.common.annotation.WebAccess;
import com.starlink.model.request.MallRefundsRequest;
import com.starlink.model.vo.book.MallArticlesBuyVO;
import com.starlink.service.MallOrderService;
import com.starlink.service.MallRefundsService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @Auther: zhouyuhang01
 * @Date: 2024/4/9 14:00
 * @Description: WechatBookOrderController
 * @Version 1.0.0
 */
@RestController
@RequestMapping("/wechat/refunds")
@Api(value = "【小程序端】商城售后模块", tags = {"【小程序端】商城售后模块"})
public class WechatRefundsController {

    @Autowired
    private MallRefundsService refundsService;

    @WebAccess(login = true)
    @ApiOperation("售后申请")
    @PostMapping("/add")
    public WebResponse<Boolean> add(@RequestBody MallRefundsRequest request) {
        return WebResponse.build(refundsService.add(request));
    }

    @WebAccess(login = true)
    @ApiOperation("取消售后")
    @PostMapping("/update")
    public WebResponse<Boolean> update(@RequestBody MallRefundsRequest request) {
        return WebResponse.build(refundsService.updateByKey(request));
    }

    @WebAccess(login = true)
    @ApiOperation("寄回商品")
    @PostMapping("/free")
    public WebResponse<Boolean> free(@RequestBody MallRefundsRequest request) {
        return WebResponse.build(refundsService.free(request));
    }

}
